import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '@/views/Login'

import layout from '@/views/layout'
import Home from '@/views/layout/Home'
import User from '@/views/layout/User'


Vue.use(VueRouter)

const routes = [{
        path: '/',
        redirect: '/layout' // 重定向
    },
    {
        path: '/login',
        component: Login
    },
    {
        path: '/layout',
        component: layout,
        redirect: '/layout/home',
        children: [{
            // path:'',
            path: 'home',
            component: Home
        }, {
            path: 'user',
            component: User
        }]
    }
]

const router = new VueRouter({
    routes
})

export default router